import tkinter as tk

n1 = 14
n2 = 10
ipx = 2

top = tk.Tk()

top.title('计算器')
top.resizable(False, False)
display = tk.Label(top, text = '0', relief = tk.SUNKEN, anchor='w')
display.pack(side = tk.TOP, fill = tk.X)
line1 = tk.Frame(top)
line1.pack(side = tk.TOP, fill = tk.X)

btn1 = tk.Button(line1, text = '1', width = n1)
btn1.pack(side = tk.LEFT, ipadx = ipx)
btn2 = tk.Button(line1, text = '2', width = n1)
btn2.pack(side = tk.LEFT, ipadx = ipx)
btn3 = tk.Button(line1, text = '3', width = n1)
btn3.pack(side = tk.LEFT, ipadx = ipx)

line2 = tk.Frame(top)
line2.pack(side = tk.TOP, fill = tk.X)
btn4 = tk.Button(line2, text = '4', width = n1)
btn4.pack(side = tk.LEFT, ipadx = ipx)
btn5 = tk.Button(line2, text = '5', width = n1)
btn5.pack(side = tk.LEFT, ipadx = ipx)
btn6 = tk.Button(line2, text = '6', width = n1)
btn6.pack(side = tk.LEFT, ipadx = ipx)

line3 = tk.Frame(top)
line3.pack(side = tk.TOP, fill = tk.X)
btn7 = tk.Button(line3, text = '7', width = n1)
btn7.pack(side = tk.LEFT, ipadx = ipx)
btn8 = tk.Button(line3, text = '8', width = n1)
btn8.pack(side = tk.LEFT, ipadx = ipx)
btn9 = tk.Button(line3, text = '9', width = n1)
btn9.pack(side = tk.LEFT, ipadx = ipx)

line4 = tk.Frame(top)
line4.pack(side = tk.TOP, fill = tk.X)
btnFu = tk.Button(line4, text = '-', width = n1)
btnFu.pack(side = tk.LEFT, ipadx = ipx)
btn0 = tk.Button(line4, text = '0', width = n1)
btn0.pack(side = tk.LEFT, ipadx = ipx)
btnDot = tk.Button(line4, text = '.', width = n1)
btnDot.pack(side = tk.LEFT, ipadx = ipx)

line5 = tk.Frame(top)
line5.pack(side = tk.TOP, fill = tk.X)
btnPlus = tk.Button(line5, text = '+', width = n2)
btnPlus.pack(side = tk.LEFT, ipadx = ipx)
btnMinius = tk.Button(line5, text = '-', width = n2)
btnMinius.pack(side = tk.LEFT, ipadx = ipx)
btnMul = tk.Button(line5, text = '*', width = n2)
btnMul.pack(side = tk.LEFT, ipadx = ipx)
btnDiv = tk.Button(line5, text = '/', width = n2)
btnDiv.pack(side = tk.LEFT, ipadx = ipx)

line6 = tk.Frame(top)
line6.pack(side = tk.TOP, fill = tk.X)
btnClear = tk.Button(line6, text = 'clear')
btnClear.pack(side = tk.LEFT, fill = tk.X, expand = tk.TRUE)

top.mainloop()